Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Solves Issue #321: Check for space separated keywords #323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JacobEFO
Copy link
Contributor

@JacobEFO JacobEFO commented Mar 7, 2020

A naive approach to handling space separated keywords fixing #321

The thought was, that it would be more interesting to find keywords separated with a list of illegal symbols, such as: ,.:;?!<>

Currently allowing especially hyphen (-) to get through, because it appears to be used already within keywords. A primary issue atm is, that some symbols such as within CPLD_Xilinx.lib contain no "K" field in its .dcm file. This triggered an error, that I handle with a try/except.

if the error is triggered it appends to the warnings, that symbols appear to not have any keywords. If illegal characters are found within the keywords, an error is appended saying it found the following illegal characters and prints them.

I would like to hear, what you think of the solution, and what specific sort of characters should be searched for within the keywords.

This way of finding illegal keyword separators within symbols
need python regular expressions.
A simple approach in finding illegal keyword separators is implemented.
It current filters keyword separation based on a regular expression,
looking for the following symbols: ,.:;?!<>

Maybe a different approach is better, and more symbols may be interesting
to filter with.
Some symbols appeared to have no "K" entry within its .dcm file,
and thus assigning the variable "keywords" threw an error.

Solved this with a try/except and append a warning message to
the -vv logger.
@cpresser
Copy link
Contributor

cpresser commented Mar 19, 2020

I think we need to discuss the list of illegal symbols.
I think the dot . should be allowed, for example in 3.3V LDO or 66.6MHz clock

edit: I was thinking of description where different rules apply.
@JacobEFO can you explain how you came up with that list and what the reasoning behind each item is?

@JacobEFO
Copy link
Contributor Author

Hey @cpresser

The list of symbols was merely a suggestion/prototype. The list is not exhaustive. There may be other more interesting symbols to filter from or some to exclude.
It is merely just a suggestion as to symbols people may end up using instead of a space for seperation of keywords. I don't necessarily expect anyone to use "!?<>" but was just used for testing.

Realistic symbols may be more: ",.:;|" or similarly. Using this list of illegal symbols is just a simple yet efficient way to handle keyword seperation.
It would be hard to detect someone not using any sort of separator, say: "lowvoltageopamp" would be cumbersome to check for, whereas assuming someone may end up writing "lowvoltage,opamp" is reasonable.

@cpresser cpresser self-assigned this Sep 13, 2020
@cpresser
Copy link
Contributor

I did a little testing and think that . should not be in that list.
There is the use-case of things like 3.3V Perhaps you can write a re that allows the dot character only if it is followed by a word character.

Missing keywords generating a warning is good. I like that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants